package com.example.demo.auto;

import java.util.concurrent.atomic.AtomicInteger;

public class MyThread implements Runnable {


    AtomicInteger integer = new AtomicInteger(100);

    @Override
    public void run() {
        int i = integer.decrementAndGet();
        System.out.println("线程："+Thread.currentThread().getName()+"的i="+integer);
    }
}



class Test{

    public static void main(String[] args) {
        MyThread myThread = new MyThread();
        for (int i = 0;i<100;i++){
            new Thread(myThread,"A"+i).start();
        }

    }
}